﻿using System;

namespace Core.Entities
{
    public unsafe struct FieldHandleStruct
    {
        private IntPtr InternalHandle;
        private int InternalIndex;
        private int InternalOffset;

        public IntPtr Handle
        {
            get
            {
                return InternalHandle;
            }
        }
        public int Index
        {
            get
            {
                return InternalIndex & 0x00ffffff;
            }
        }
        public int Offset
        {
            get
            {
                return InternalOffset & 0x00ffffff;
            }
        }

        public FieldHandleStruct(IntPtr FieldHandle)
        {
            var PtrHandleInfo = (FieldHandleStruct*)FieldHandle;

            InternalHandle = PtrHandleInfo->InternalHandle;
            InternalIndex = PtrHandleInfo->InternalIndex;
            InternalOffset = PtrHandleInfo->InternalOffset;
        }
    }
}
